<template>
  <div>
    <!-- 抖音商品属性dialog -->
    <dou-yin-goods-property v-if="platformType === 1" 
      :showFlag="showFlag" 
      :shopId="shopId"
      :goodsObj="goodsObj" 
      @callback="doCallbackProperty">
    </dou-yin-goods-property>

    <!-- 快手商品属性dialog -->
    <kuai-shou-goods-property v-if="platformType === 2" 
      :showFlag="showFlag" 
      :shopId="shopId"
      :goodsObj="goodsObj" 
      @callback="doCallbackProperty">
    </kuai-shou-goods-property>

    <!-- 1688商品属性dialog -->
    <open-alibaba-goods-property v-if="platformType === 7" 
      :showFlag="showFlag"
      :shopId="shopId"
      :goodsObj="goodsObj" 
      @callback="doCallbackProperty">
    </open-alibaba-goods-property>
  </div>
</template>

<script>
  import douYinGoodsProperty from './dou-yin-goods-property'
  import kuaiShouGoodsProperty from './kuai-shou-goods-property'
  import openAlibabaGoodsProperty from './open-alibaba-goods-property'

  export default {
    components: {
      douYinGoodsProperty,
      kuaiShouGoodsProperty,
      openAlibabaGoodsProperty
    },
    props: {
      showFlag: {
        type: Boolean,
        default() {
          return false
        }
      },
      // 平台类型
      platformType: {
        type: Number
      },
      // 店铺id
      shopId: {
        type: String
      },
      // 商品对象
      goodsObj: {
        type: Object
      }
    },
    data() {
      return {
      }
    },
    created() {
      if (!this.shopId) {
        this.$message({ type: 'warning', message: '店铺不能为空' })
        return
      }
    },
    methods: {
      // 设置商品属性回调
      doCallbackProperty(callbackFlag) {
        this.$emit('callback', callbackFlag, this.platformType)
      }
    }
  }
</script>

<style scoped>

</style>